import * as React from 'react'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { client, trpc } from './trpc'
import Home from './Home'

const { useState } = React
export default function App() {
  const [queryClient] = useState(() => new QueryClient())
  const [trpcClient] = useState(client)
  return (
    // Setup trpc's react query integration.
    // https://trpc.io/docs/v10/client/react/setup#4-add-trpc-providers
    <trpc.Provider client={trpcClient} queryClient={queryClient}>
      <QueryClientProvider client={queryClient}>
        <Home />
      </QueryClientProvider>
    </trpc.Provider>
  )
}
